package movee.grpc.server;

import io.grpc.stub.StreamObserver;
import movee.protobuf.lib.greeter.GreeterGrpc;
import movee.protobuf.lib.greeter.HelloRequest;
import movee.protobuf.lib.greeter.HelloResponse;

/**
 * grpc服务实现逻辑
 */
public class GreeterService extends GreeterGrpc.GreeterImplBase {

    @Override
    public void hello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {
        String name = request.getName();
        HelloResponse response = HelloResponse.newBuilder().setGreeting("Hello " + name +
                "[this is reply from GreeterServer]").build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }
}
